import React, { Component } from 'react'
// 类型验证
import PropType from 'prop-types'

// 直接参数
function ChildCpn(props) {
  const { name, age, height } = props
  const { names } = props
  return (
    <div>
      <h2>{name + " " + age + " " + height}</h2>
      <ul>
        {
          names.map((item, index) => {
            return <li>{item}</li>
          })
        }
        
      </ul>
    </div>
  )
}

// class ChildCpn2 extends Component {
//   static PropType = {

//   }
// }

ChildCpn.PropType = {
  name: PropType.string,
  age: PropType.number,
  height: PropType.number,
  names: PropType.array
}


export default class App extends Component {
  render() {
    return (
      <div>
        <ChildCpn name="yz" age={18} height={1.88} names={["aaa", "bbb"]}/>
        <ChildCpn name="jay" age={20} height={1.98} names={["ccc", "ddd"]}/>
      </div>
    )
  }
}
